/**
 * 
 */
package com.monte.export.excel.template;

import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.lang.StringUtils;


/**  
 * <b>System：</b>NDMP<br/>
 * <b>Title：</b>Td.java<br/>
 * <b>Description：</b> 单元格配置<br/>
 * <b>@author： </b>fengmengyue<br/>
 * <b>@date：</b>2014-4-2 上午10:23:50<br/>  
 * <b>@version：</b> 1.0.0.0<br/>
 * <b>Copyright (c) 2014 ASPire Tech.</b>   
 *   
 */
public class Td {
	/**
	 * 单元格值配置
	 */
	private String label;
	
	/**
	 * 对齐方式
	 */
	private String align;
	
	/**
	 * 单元格宽度
	 */
	private int width;
	
	/**
	 * 行高
	 */
	private int height;
	
	/**
	 * 行合并
	 */
	private int rowspan = 1;
	
	/**
	 * 列合并
	 */
	private int colspan = 1;
	
	/**
	 * 取值key
	 */
	private String valueKey;
	
	/**
	 * 数据类型()
	 */
	private String datatype = "String";
	
	/**
	 * 时间类型格式化
	 */
	private String dateFormat = "yyyy-MM-dd HH:mm:ss";

	/**
	 * 所在行
	 */
	private Tr tr;
	
	/**
	 * 字体颜色
	 * @see org.apache.poi.ss.usermodel.IndexedColors
	 */
	private String textColor;
	
	/**
	 * 字体大小
	 */
	private String fontSize;
	
	/**
	 * 背景色
	 * @see org.apache.poi.ss.usermodel.IndexedColors
	 */
	private String backgroundColor;
	
	/**
	 * 边框
	 */
	private String border;
	
	/**
	 * 边框颜色
	 * @see org.apache.poi.ss.usermodel.IndexedColors
	 */
	private String borderColor;
	
	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getAlign() {
		if(StringUtils.isEmpty(align)){
			try {
				return BeanUtilsBean.getInstance().getProperty(this, "tr.table.align");
			} catch (Exception e) {
				return null;
			}
		}
		return align;
	}

	public void setAlign(String align) {
		this.align = align;
	}

	public int getRowspan() {
		return rowspan;
	}

	public void setRowspan(int rowspan) {
		this.rowspan = rowspan;
	}

	public int getColspan() {
		return colspan;
	}

	public void setColspan(int colspan) {
		this.colspan = colspan;
	}

	public String getValueKey() {
		return valueKey;
	}

	public void setValueKey(String valueKey) {
		this.valueKey = valueKey;
	}

	public void setDateFormat(String dateFormat) {
		this.dateFormat = dateFormat;
	}

	public String getDateFormat() {
		return dateFormat;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getWidth() {
		return width;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getHeight() {
		return height;
	}

	public void setTr(Tr tr) {
		this.tr = tr;
	}

	public Tr getTr() {
		return tr;
	}

	public void setDatatype(String datatype) {
		this.datatype = datatype;
	}

	public String getDatatype() {
		return datatype;
	}

	public void setTextColor(String textColor) {
		this.textColor = textColor;
	}

	public String getTextColor() {
		if(StringUtils.isEmpty(textColor)){
			try {
				return BeanUtilsBean.getInstance().getProperty(this, "tr.table.textColor");
			} catch (Exception e) {
				return null;
			}
		}
		return textColor;
	}

	public void setFontSize(String fontSize) {
		this.fontSize = fontSize;
	}

	public String getFontSize() {
		if(StringUtils.isEmpty(fontSize)){
			try {
				return BeanUtilsBean.getInstance().getProperty(this, "tr.table.fontSize");
			} catch (Exception e) {
				return null;
			}
		}
		return fontSize;
	}

	public void setBackgroundColor(String backgroundColor) {
		this.backgroundColor = backgroundColor;
	}

	public String getBackgroundColor() {
		if(StringUtils.isEmpty(backgroundColor)){
			try {
				return BeanUtilsBean.getInstance().getProperty(this, "tr.table.backgroundColor");
			} catch (Exception e) {
				return null;
			}
		}
		return backgroundColor;
	}

	public void setBorder(String border) {
		this.border = border;
	}

	public String getBorder() {
		if(StringUtils.isEmpty(border)){
			try {
				return BeanUtilsBean.getInstance().getProperty(this, "tr.table.border");
			} catch (Exception e) {
				return null;
			}
		}
		return border;
	}

	public void setBorderColor(String borderColor) {
		this.borderColor = borderColor;
	}

	public String getBorderColor() {
		if(StringUtils.isEmpty(borderColor)){
			try {
				return BeanUtilsBean.getInstance().getProperty(this, "tr.table.borderColor");
			} catch (Exception e) {
				return null;
			}
		}
		return borderColor;
	}
}
